<?
require_once("inc.init.php");

if($_POST['action'] == 'validarCuit')
{
    $messenger = new Messenger();

    $validator = new telefonicaDataObjectValidator();
    $validator->_dbLink= $dbLink;
    $validator->setFields(array('cuit'));
    $data = $_POST;
    if($validator->validate($data) && $messenger->countMessages()==0)
    {
        $telefonos = array();
        $telefonos = getTelefonosSpeedy($_POST['cuit']);
        $response['telefonos'] = $telefonos;
        
        $response['success'] = true;
    }
    else
    {
        $validator->addErrorsToMessenger($messenger);
        $response['success'] = false;
        $response['message'] = $messenger->getMessages();
    }

    echo json_encode($response);
    exit();
}

if(!isset($_GET["c"])) die();
$controller = $module->id."Ajax".ucfirst($_GET["c"]);
new $controller;


?>
